package test;

import java.util.Date;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import design.donkey.framework.common.orm.annotation.ColumnMeta;
import design.donkey.framework.common.orm.annotation.JdbcType;
import design.donkey.framework.common.orm.annotation.TableMeta;
import lombok.Data;

/**
 * SecurityUser
 *
 * @author zhangjiakung
 * @since 0.0.1
 */
@TableName("security_user")
@TableMeta(comment = "用户")
@Data
public class SecurityUserMyBatisPlus {

    /**
     * 用户 id
     */
    @TableId
    @ColumnMeta(comment = "用户 ID")
    private Integer id;

    /**
     * 账号
     */
    @TableField
    @ColumnMeta(length = 50, unique = true, comment = "账号")
    private String username;

    /**
     * 昵称
     */
    @ColumnMeta(name = "nickname", unique = true, comment = "昵称")
    private String nickname;

    /**
     * 归属地编码
     */
    @TableField(value = "city_code")
    @ColumnMeta(comment = "归属地编码")
    private String cityCode;

    /**
     * 单位 ID
     */
    @TableField(value = "company_id")
    @ColumnMeta(comment = "单位 ID")
    private Integer companyId;

    /**
     * 过期时间
     */
    @TableField(value = "expired_date")
    @ColumnMeta(comment = "过期时间")
    private Date expiredDate;

    /**
     * 上次登录时间
     */
    @TableField(value = "last_login_date")
    @ColumnMeta(comment = "上次登录时间")
    private Date lastLoginDate;

    /**
     * 密码
     */
    @TableField(value = "password")
    @ColumnMeta(jdbcType = JdbcType.TEXT, comment = "密码")
    private String password;

    /**
     * 备注
     */
    @TableField(value = "remarks")
    @ColumnMeta(jdbcType = JdbcType.TEXT, comment = "备注")
    private String remarks;

    /**
     * 是否已删除 <br/>
     *
     * 0 未删除 1 已删除
     */
    @TableField(value = "`deleted`")
    @ColumnMeta(nullable = false, defaultValue = "0", comment = "是否已删除")
    private Integer deleted;

    /**
     * 创建时间
     */
    @ColumnMeta(location = Integer.MAX_VALUE, defaultValue = "CURRENT_TIMESTAMP", comment = "创建时间")
    private Date createTime;

    /**
     * 最后修改时间
     */
    @ColumnMeta(location = Integer.MAX_VALUE, defaultValue = "CURRENT_TIMESTAMP",
        defaultValueForUpdate = "CURRENT_TIMESTAMP", comment = "最后修改时间")
    private Date modifiedTime;

    /**
     * 单位名称
     */
    @TableField(exist = false)
    private String companyName;

    /**
     * 归属地
     */
    @TableField(exist = false)
    private String cityName;

    /**
     * 角色ID
     */
    @TableField(exist = false)
    private Integer roleId;

    /**
     * 角色名称
     */
    @TableField(exist = false)
    private String roleName;

    /**
     * 内置
     */
    @TableField(exist = false)
    private Boolean isInner;

}
